package org.meandslava.calc.views;

import org.meandslava.calc.R;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.ImageButton;

public class SmartImageButton extends ImageButton {
	public SmartImageButton(Context context) {
		super(context);
	}

	public SmartImageButton(Context context, AttributeSet attrs) {
		super(context, attrs);
	}

	public SmartImageButton(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
	}
	{
		setAdjustViewBounds(true);
		int padding_in_dp = 2;
	    final float scale = getResources().getDisplayMetrics().density;
	    int p = (int) (padding_in_dp * scale + 0.5f);
		setPadding(p, p, p, p);
		setScaleType(ScaleType.CENTER_INSIDE);
		setBackgroundResource(R.drawable.button);
	}
	
}
